﻿using UnityEngine;
using System.Collections;

public static class MathUtils
{
    public static int GetHashCode(int X, int Y)
    {
        return X << 16 | Y;
    }

    #region Bit
    public static uint BitSet(uint Data, int Bit)
    {
        if ((Bit >= 0) && (Bit < (int)sizeof(uint) * 8))
        {
            Data |= (uint)(1 << Bit);
        }

        return Data;
    }

    public static uint BitClear(uint Data, int Bit)
    {
        if ((Bit >= 0) && (Bit < (int)sizeof(uint) * 8))
        {
            Data &= (uint)(~(1 << Bit));
        };
        return Data;
    }

    public static bool BitCheck(uint Data, int Bit)
    {
        if ((Bit >= 0) && (Bit < (int)sizeof(uint) * 8))
        {
            Data &= (uint)(1 << Bit);
            if (Data != 0) return true;
        }
        return false;
    }
    #endregion
}
